package com.usian.wemedia.controller.v1;

import com.usian.common.aliyun.GreeTextScan;
import com.usian.common.aliyun.GreenImageScan;
import com.usian.common.fastdfs.FastDFSClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class AliyunTest {

    @Autowired
    private GreeTextScan greeTextScan;

    @Autowired
    private GreenImageScan greenImageScan;

    @Autowired
    private FastDFSClient fastDFSClient;

    @GetMapping("text")
    public void testText() throws Exception{
        Map map = greeTextScan.greeTextScan("我是一个文本,aa买卖是违法的");//"我是一个文本,冰毒买卖是违法的"
        System.out.println(map);
    }

    @GetMapping("image")
    public void testImage() throws Exception {
        byte[] image1 = fastDFSClient.download("group1", "M00/00/00/wKg6imKr3RWAI1vZAAANDPBz9L8997.png");
        List<byte[]> images = new ArrayList<>();
        images.add(image1);
        Map map = greenImageScan.imageScan(images);
        System.out.println(map);
    }
}
